package com.up.vms.domain.vm.repository;

import com.up.vms.domain.vm.entity.UserActivityInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

public interface UserActivityInfoRepository extends JpaRepository<UserActivityInfo, Long> {

    Long countByIdNumberAndActivityId(String idNumber, Long activityId);

    UserActivityInfo findByIdNumberAndActivityId(String idNumber, Long activityId);

    @Transactional
    @Modifying
    @Query(value = "truncate table T_VMS_User_Activity_Info", nativeQuery = true)
    void truncateTable();

    void deleteByActivityId(Long activityId);
}
